<html>
<head>
    <meta charset="UTF-8">
    <title>配置</title>
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css">
    <link rel="stylesheet" href="__CSS__/elpis.min.css">
    <script src="__JS__/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="__JS__/jquery.form.min.js"></script>
    <script type="text/javascript" src="__JS__/admin.js"></script>
    <script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
</head>
<body>

{eq name="do" value="address"}
<div class="box-info">
    <form class="myform" name="myform" action="{:U('Order/edit?do=address')}" method="post">

        <div class="form-group">
            <label width="125"> {:L('Order_address_area')}：</label>
            <div>
                <div id="areaselect">
                    <select name="province" id="province" onchange="area_change(this.value, 1,'province','city','area');" class="ddlbox" >
                        <option value="0">{:L('Order_select_province')}</option>
                    </select>
                    <select name="city" onchange="area_change(this.value, 2,'province','city','area');" id="city" class="ddlbox" >
                        <option value="0">请选择城市...</option>
                    </select>
                    <select name="area" onchange="area_change(this.value, 3,'province','city','area');" id="area" class="ddlbox" >
                        <option value="0">{:L('Order_select_area')}</option>
                    </select>
                    <span class="text-danger">*</span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label  width="125" >{:L('Order_address_consignee')}： </label>
            <div>
                <input name="consignee" class="form-control" id="consignee"type="text" size="50" value="{$order.consignee}" />
                <span class="text-danger">*</span>
            </div>
        </div>
        <div class="form-group">
            <label  width="125" >{:L('Order_address_address')}： </label>
            <div>
                <input   name="address" class="form-control"  id="address" type="text" size="50"  value="{$order.address}" />
                <span class="text-danger">*</span>
            </div>
        </div>
        <div class="form-group">
            <label  width="125" >{:L('Order_address_mobile')}： </label>
            <div>
                <input name="mobile" class="form-control"  id="mobile" type="text" size="50"  value="{$order.mobile}"/>
                <span class="text-danger">*</span>
            </div>
        </div>
        <div class="form-group">
            <th  width="125" >{:L('Order_address_tel')}：</th>
            <td><input name="tel" class="form-control"  id="tel"  type="text" size="50"  value="{$order.tel}" />
            </td>
        </div>
        <div class="form-group">
            <label  width="125" >{:L('Order_address_email')}： </label>
            <div><input name="email" class="form-control"  id="email"type="text" size="50"  value="{$order.email}"/>
            </div>
        </div>
        <div class="form-group">
            <label  width="125" >{:L('Order_address_zipcode')}： </label>
            <div>
                <input name="zipcode" class="form-control"  id="zipcode" type="text" size="50"  value="{$order.zipcode}"/>
            </div>
        </div>

        <input type="hidden" name="id" value="{$order.id}">
        <input name="submit" class="btn btn-primary" type="submit" value="确认">
    </form>
</div>

<script>area_change(0, 0,'province','city','area','{$order.province}','{$order.city}','{$order.area}');</script>
{/eq}

{eq name="do" value="data"}
<div class="box-info">
    <form class="myform" name="myform" action="{:U('Order/edit?do='.$do)}" method="post">
        <table class="table">
            {volist name="order_data" id="vo"}
            <tr>
                <td width="50">
                    <input name="data_id[]" type="hidden" value="{$vo['id']}" />
                    <img src="{$vo['goods_thumb']|thumb}" alt="{$vo['goods_name']}" width="50" height="50"/>
                </td>
                <td>{$vo['goods_name']}</td>
                <td width="80">
                    <input type="text" name="goods_price[]" size="5" value="{$vo['goods_price']}">
                </td>
                <td width="40"><input type="text" name="goods_num[]" size="5" value="{$vo['goods_num']}"> </td>
                <td width="80">{$vo['price']|number_format=###,2}</td>
                <td width="40"><a href="{:U('Order/edit?do='.$do.'&delete=1&data_id='.$vo['id'].'&id='.$order[id])}">{:L('delete')}</a></td>
            </tr>
            {/volist}
            <tr>
                <td colspan="5" align="right">{:L('Order_goods_count')}：</td>
                <td><b style="color:#FB0000;">{$order.amount}</b></td>
            </tr>
        </table>
        <input type="hidden" name="id" value="{$order.id}">
        <input name="submit" class="btn btn-primary" type="submit" value="确认">
    </form>
</div>
{/eq}

{eq name="do" value="money"}
<div class="box-info">
    <form class="myform" name="myform" action="{:U('Order/edit?do=money')}" method="post">
        <div class="form-group">
            <th  width="125" >{:L('Order_goods_amount')}： </th><td>{$order.amount}</td>
            <th  width="125" >{:L('Order_amount')}： </th><td>{$order.order_amount}</td>
        </div>

        <div class="form-group">
            <th  width="125" >{:L('Order_invoice_fee')}： </th><td>{$order.invoice_fee|number_format=###,2}</td>
            <th  width="125" >{:L('Order_pay_fee')}： </th><td>{$order.pay_fee|number_format=###,2}</td>
        </div>

        <div class="form-group">
            <th  width="125" >{:L('Order_shipping_fee')}： </th><td>{$order.shipping_fee|number_format=###,2}</td>
            <th  width="125" >{:L('Order_insure_fee')}：</th><td>{$order.insure_fee|number_format=###,2}</td>
        </div>

        <div class="form-group">
            <th  width="125" >{:L('Order_discount')}： </th><td><input type="text" id="discount" name="discount" onchange="order_amount()" size="10" value="{$order.discount|number_format=###,2}"></td>
            <th  width="125" >{:L('Order_count_amount')}：</th><td><b id="order_amount" style="color:#FB0000;font-size:14px;">{$order.order_amount}</b></td>
        </div>
        <input type="hidden" name="id" value="{$order.id}">
        <input name="submit" class="btn btn-primary" type="submit" value="确认">
    </form>
</div>
<script>
function order_amount(){
    var order_amount = {$order.order_amount};
    var discount = $('#discount').val();
    $('#order_amount').html(order_amount-discount);
}
</script>
{/eq}

{eq name="do" value="shipping"}
<div class="box-info">
    <h3>配送方式</h3>
    <hr>
    <form class="myform" name="myform" action="{:U('Order/edit?do='.$do)}" method="post">
        <div class="shipping_input">
            <input type="hidden" id="shipping_name" name="shipping_name" />
            <input type="hidden" id="shipping_fee"  name="shipping_fee" />
            <input type="hidden" id="insure_fee" name="insure_fee" />
            <input type="hidden" id="isinsure" name="isinsure" />
        </div>

        <table class="form-table" cellspacing='1' cellpadding='3' width="100%" >
            {volist name="shipping" id="r"}
            <tr><td><input type="radio" class="input_radio" id="shipping_{$r.id}"   {if condition="$r['id']==$order['shipping_id']"} checked{/if} name="shipping_id" value="{$r.id}" />{$r.name} &nbsp;  {:L('Order_shipping_fee')}：￥{$r.first_price} &nbsp;  {:L('Order_shipping_second_price')}：￥{$r.second_price}
            {if condition="$r[is_insure]"}
                <input type="checkbox" class="input_radio insure" id="insure_{$r.id}" name="insure_{$r.id}" {if  condition="$r['id']==$order['shipping_id'] && $order['insure_fee']>0"} checked{/if} value="1"/>{:L('Order_shipping_is_insure')}：{$r.insure_fee}%
                {if condition="$r[insure_low_price]"} {:L('Order_shipping_low_price')}{$r.insure_low_price}{:L(rmb)}{/if} {/if}
            </td></tr>
            {/volist}
        </table>

        <input type="hidden" name="id" value="{$order.id}">
        <input name="submit" class="btn btn-primary" type="submit" value="确认">
    </form>
</div>
{/eq}

{eq name="do" value="shipping_sn"}
<div class="box-info">
    <h3>货单号码</h3>
    <hr>
    <form class="myform" name="myform" action="{:U('Order/edit?do=shipping_sn')}" method="post">
        <div class="form-group">
            <label>货单号码：</label>
            <input type="text" name="shipping_sn" size="40" class="form-control" id="shipping_sn" value="{$order.shipping_sn}">
        </div>

        <input type="hidden" name="id" value="{$order.id}">
        <input name="submit" class="btn btn-primary" type="submit" value="确认">
    </form>
</div>
{/eq}

{eq name="do" value="shipping_show"}
    货单号码：{$order.shipping_sn}
{/eq}


<script>
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

    $(document).ready(function() {
        $('.myform').ajaxForm({
            success:  complete,  // post-submit callback
            dataType: 'json'
        });
    });

    function complete(data){
        if (data.status == 1) {
            parent.layer.msg(data.info, {
                icon: 1,
                time: 5000 //2秒关闭（如果不配置，默认是3秒）
            });
            parent.location.reload();
            parent.layer.close(index);
        } else {
            layer.msg(data.info, {
                icon: 2,
                time: 2000 //2秒关闭（如果不配置，默认是3秒）
            });
        }
    }
</script>

</body>
</html>